package service

import (
	"kandy/app/dao"
	"kandy/app/model"
	"time"
)

var (
	userDao = new(dao.UserDao)
)

type UserService struct {
}

//添加用户
func (this *UserService) Insert(username, password string) int64 {
	userModel := &model.User{}
	userModel.UserName = username
	userModel.Password = password
	userModel.CreateTime = time.Now()
	id := userDao.Insert(userModel)
	return id
}

func (this *UserService) SelectUserByName(username string) []model.User {
	return userDao.GetUserByName(username)
}

func (this *UserService) SelectAllUser() []model.User {
	return userDao.SelectAllUser()
}
